#pragma once

#include "iostream"
#include "vector"
#include "algorithm"
#include "unordered_map"

using namespace std;

/*HJJ QQ479287006
 *
 * */
vector<int> getVec(string &str) {
    vector<int> ret;
    for (int i = 1; i < str.size(); ++i) {
        ret.push_back(str[i] - str[i - 1]);
    }

    return ret;
}

bool check(vector<int> &s1, vector<int> &s2) {
    for (int i = 0; i < s1.size(); ++i) {
        if (s1[i] != s2[i])
            return false;

    }


    return true;

}

string oddString(vector<string> &words) {

    vector<vector<int>> res;
    //unordered_map<int,vector<int>> mp;
    for (int i = 0; i < words.size(); i++) {
        res.push_back(std::move(getVec(words[i]));
    }

    //如何判断一堆二位数组中那个不同元素  1 4 4 4 4

    //sort(res);
    vector temp;
    for (int i = 1; i < res.size(); ++i) {
        if (check(res[i], res[i - 1])) {
            temp = res[i];
            break;;
        }

    }

    for (int i = 0; i < res.size(); ++i) {
        if (!check(res[i], temp))
            return i;

    }


    // if ()

    return -1;

}